Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

[WIP] refactoring of install action for '--requirements' and 'download' #270

Open
wants to merge 17 commits into
base: devel
Choose a base branch
from

Conversation

alikins
Copy link
Contributor

@alikins alikins commented May 23, 2019

SUMMARY

This is mostly refactoring and fixes and better testing to install action and related
modules in preparation for 'download' subcommand and ''--requirements" file support

ISSUE TYPE
  • Feature Pull Request
  • Bugfix Pull Request
MAZER VERSION
name = mazer
version = 0.5.0
config_file = /home/adrian/.ansible/mazer.yml
uname = Linux, newswoop, 5.0.5-200.fc29.x86_64, #1 SMP Wed Mar 27 20:58:04 UTC 2019, x86_64
executable_location = /home/adrian/venvs/mazer_0.4.0_py36/bin/mazer
python_version = 3.6.8 (default, Jan 27 2019, 09:00:23) [GCC 8.2.1 20181215 (Red Hat 8.2.1-6)]
python_executable = /home/adrian/venvs/mazer_0.4.0_py36/bin/python

ADDITIONAL INFORMATION

alikins added 15 commits May 23, 2019 13:44
Get the list of Reqs in the cli, and pass into
install_repository_specs_loops()

'editable' and 'namespace_override' are only needed for creating
the Requirement() objects, so dont pass into loop
install_repositories_matching_repository_specs() was no
inaccurate as well as still being too long, so change it.
ie, one InstalledRepositoryDatabase() instead of a new instance
in each helper method. The IRDB class is stateless, but using
the same ref makes unit testing easier.

Update unit tests for better coverage of action.install
kinda sorta emulate a dep solving iteration
Move requirements_from_strings() from ansible_galaxy.actions.install
to ansible_galaxy.requirements with from_requirements_dict

Reorder the methods in ansible_galaxy.actions.install based on
order of execution instead of the other style which we'll
call... aleatoric?

Add test_requirements unit tests
There is no longer the separate concept of 'dependencies'
(install time) and 'requirements' (run time... and install time).

There are only 'dependencies' now.

Which we call 'requirements' almost everywhere
inside the code because reasons.

But for the moment, at least consistently call
them by the wrong name everywhere, so they
can all be changed at the same time.
The ansible_galaxy_cli code now calls
ansible_galaxy.actions.install.run() instead of
install_whatever_loop() as before.

Plan is to move other actions to similar api.

A run() that more or less takes the cli args (strings).

And a suitably named method in the action module that
shows a more pythonic signature.

For example, here
run() takes a list of strings for requirement_spec_strings,
while install_requirements_loop() takes a list of Requirement()
objects.

Also, run() returns only a return code suitable for sys.exit(),
while the more pythonic method will return a results dict with
a 'status' and an 'errors' list.
@alikins alikins force-pushed the install_update_fetch_tests branch from b385388 to fda5f7e Compare May 23, 2019 17:44
alikins added 2 commits May 23, 2019 13:45
Out of ansible_galaxy.install and into repository_spec
so it is easier to share.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant